cmake_minimum_required(VERSION 2.8)
project(vcap_3403)

set(cc "aarch64-mix210-linux-gcc")
set(cxx "aarch64-mix210-linux-g++")

#set(CMAKE_CXX_STANDARD 11)
#set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_SYSTEM_NAME Linux)

set(CMAKE_C_COMPILER "aarch64-mix210-linux-gcc")
set(CMAKE_CXX_COMPILER "aarch64-mix210-linux-g++")

#link is dynamic library
add_definitions(-DSENSOR0_TYPE=OV_OS08A20_MIPI_8M_30FPS_12BIT)
#add_definitions(-D__NOTDIR_FILE__='\"$(subst $(dir $<),,$<)\"')
#add_definitions(-D__NOTDIR_FILE__="'\"$(subst $(dir $<),,$<)\"'")
#add_definitions(-D__NOTDIR_FILE__="'\"${FILE_NAME}\"'")

set(CMAKE_CXX_FLAGS "-fPIE -pie -s -Wall -fsigned-char -D__NOTDIR_FILE__='\"$(subst $(dir $<),,$<)\"' -DOT_RELEASE -DVER_X=1 -DVER_Y=0 -DVER_Z=0 -DVER_P=0 -DVER_B=10 -DUSER_BIT_64 -DKERNEL_BIT_64 -Wno-date-time")

set(CMAKE_C_FLAGS "-fPIE -pie -s -Wall -fsigned-char -D__NOTDIR_FILE__='\"$(subst $(dir $<),,$<)\"' -DOT_RELEASE -DVER_X=1 -DVER_Y=0 -DVER_Z=0 -DVER_P=0 -DVER_B=10 -DUSER_BIT_64 -DKERNEL_BIT_64 -Wno-date-time")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -Dss928v100 -DOT_XXXX -lpthread -lm -ldl -DISP_V2 -lstdc++ -Wall -fsigned-char -mcpu=cortex-a53 -fno-aggressive-loop-optimizations -ldl -ffunction-sections -fdata-sections -O2 -fstack-protector-strong -fPIC -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -DOT_ACODEC_TYPE_HDMI -DOT_ACODEC_TYPE_INNER -DOT_VQE_USE_STATIC_MODULE_REGISTER -DOT_AAC_USE_STATIC_MODULE_REGISTER -DOT_AAC_HAVE_SBR_LIB")


set(LINK_LIB_SDK ss_mpi  -fno-common -mcpu=cortex-a53 -fno-aggressive-loop-optimizations -Wl,-z,relro -Wl,-z,noexecstack -Wl,-z,now,-s -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE dl -rdynamic  ss_voice_engine ss_upvqe ss_dnvqe aac_comm aac_enc aac_dec aac_sbr_enc aac_sbr_dec vqe_res vqe_record vqe_hpf vqe_anr vqe_aec vqe_agc vqe_eq vqe_talkv2 vqe_wnr aac_dec aac_enc aac_comm aac_sbr_dec aac_sbr_enc securec)
set(LINK_LIB_ISP ss_ae ss_isp ot_isp ss_awb ss_dehaze ss_extend_stats ss_drc ss_ldci ss_crb ss_bnr ss_calcflicker ss_ir_auto ss_acs ss_hdmi)
set(LINK_LIB_SENSOR sns_os08a20 sns_os05a10_2l_slave sns_imx347_slave sns_imx485 sns_imx585 sns_os04a10 sns_os08b10)
set(LINK_LIB_COMMON pthread m dl)
set(LINK_LIB_OPENCV opencv_world)

set(SDK_PATH ${CMAKE_CURRENT_SOURCE_DIR}/sdk)
set(VENDOR_PATH ${CMAKE_CURRENT_SOURCE_DIR}/vendor)
#set(OPENCV_PATH ${CMAKE_CURRENT_SOURCE_DIR}/3rdPart/opencv-3.4.16)


include_directories(
    .
    common/
    common/audio/adp
    sdk/include/
    vendor/es8388/
    src/commonTool/canbus/
    src/commonTool/common/
    src/commonTool/uart/
    src/commonTool/netBase/asynchronous/
    src/commonTool/netBase/socketBase/
    src/rtsp/
    src/voOutput/
    src/videoGraphics/
    src/sysInit/
    src/serverComm/
    src/imgProcess/
    src/imgProcess/fdsst/
    src/imgProcess/sky_ob_detect/
    src/imgProcess/trackAlgor/
    3rdPart/rtsp/3rdpart/
    3rdPart/rtsp/
    3rdPart/opencv-3.4.16/include
)


set(LIB_DIR ${CMAKE_SOURCE_DIR}/sdk/lib  ${CMAKE_SOURCE_DIR}/3rdPart/opencv-3.4.16/lib/)

link_directories(${LIB_DIR})


aux_source_directory(./common/ all_source)
aux_source_directory(./common/audio/adp all_source)
aux_source_directory(./src/commonTool/canbus all_source)
aux_source_directory(./src/commonTool/common all_source)
aux_source_directory(./src/commonTool/netBase/asynchronous all_source)
aux_source_directory(./src/commonTool/netBase/socketBase all_source)
aux_source_directory(./src/commonTool/uart all_source)
aux_source_directory(./src/videoGraphics all_source)
aux_source_directory(./src/sysInit all_source)
aux_source_directory(./src/imgProcess/ all_source)
aux_source_directory(./src/imgProcess/fdsst/ all_source)
aux_source_directory(./src/imgProcess/trackAlgor/ all_source)
aux_source_directory(./src/imgProcess/sky_ob_detect/ all_source)
aux_source_directory(./src/rtsp all_source)
aux_source_directory(./src/voOutput all_source)
aux_source_directory(./src/serverComm all_source)
aux_source_directory(3rdPart/rtsp/3rdpart/md5 all_source)
aux_source_directory(3rdPart/rtsp/net all_source)
aux_source_directory(3rdPart/rtsp/xop all_source)


message(${all_source})
add_executable(vcap_3403 main.cpp ${all_source})

target_link_libraries(vcap_3403 
    ${LINK_LIB_SDK}
    ${LINK_LIB_ISP}
    ${LINK_LIB_SENSOR}
    ${LINK_LIB_COMMON}
    ${LINK_LIB_OPENCV}
) 

